package com.qf.test;

import com.qf.ProducerApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.UUID;

@SpringBootTest(classes = ProducerApplication.class)
@RunWith(SpringRunner.class)
public class testSimple {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Test
    public void testSimpleSend() {
        rabbitTemplate.convertAndSend("testQueue1","hello1 rabbit!");

        CorrelationData messageId = new CorrelationData(UUID.randomUUID().toString());

        rabbitTemplate.convertAndSend("testQueue1", (Object) "hello1 rabbit!", messageId);
    }
}
